<?php
/**
 * I/O Filtering Class
 *
 * @package Mhtml
 * @author Matt Pike
 */
class Filter{

	/**
	 * Encode a string to be safe for output
	 *
	 * @param string $string
	 */
	public static function userOutput($string){
		return htmlentities($string,ENT_QUOTES);
	}
	
	/**
	 * Return if string contains alphabetic characters only
	 *
	 * @param string $input
	 * @return string
	 */
	public static function alpha($input){
		return ctype_alpha($input) ? $input : false;
	}
	
	/**
	 * Return if string contains alphabetic or numerical characters only
	 *
	 * @param string $input
	 * @return string
	 */
	public static function alphaNumeric($input){
		return ctype_alnum($input) ? $input : false;
	}
	
	/**
	 * Return if string contains numerical characters only
	 *
	 * @param string $input
	 * @return string
	 */
	public static function numeric($input){
		return ctype_digit($input) ? $input : false;
	}
}
?>